<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      > 

    <h:head> 
        <title>Add Venue For TCube Admin</title> 

        <style type="text/css"> 

            .gritter-notice-wrapper { 
                left:200px; 
                top:50px; 
            } 
        </style> 

    </h:head> 
    <h:body>
        <h1>Stakeholder Account and Billing Management (TCube)</h1> 
        <p:layout style="table-layout:auto; height:700px ">
            <p:layoutUnit position="left" header="Navigation" width="300">
                <h:form id="TCubeMenu">
                    <h:commandLink value="Add Stakeholder" action="addstakeholder.xhtml?faces-redirect=true"/>
                    <br/>
                    <h:commandLink value="Delete Stakeholder" action="deletestakeholder.xhtml?faces-redirect=true"/>
                    <br/>
                    <h:commandLink value="Modify Stakeholder" action="modifystakeholder.xhtml?faces-redirect=true"/>
                    <br/>
                    <h:commandLink value="Add Venue" action="addvenue.xhtml?faces-redirect=true"/>
                    <br/>
                    <h:commandLink value="Delete Venue" action="deletevenue.xhtml?faces-redirect=true"/>
                    <br/>
                    <h:commandLink value="Modify Venue" action="modifyvenue.xhtml?faces-redirect=true"/>
                    <br/>
                    <h:commandLink value="Delete Layout" action="deletelayout.xhtml?faces-redirect=true"/>
                    <br/>
                </h:form>
            </p:layoutUnit>
            <p:layoutUnit position="center" header="Add New Venue">
                <h:form id="addVenue">
                    <p:panel id="panel" >
                        <p:ajaxStatus style="width:16px;height:16px;">
                            <f:facet name="start">
                                <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value="" />
                            </f:facet>
                        </p:ajaxStatus>
                        <p:messages />
                        <h:panelGrid columns="3">
                            <h:outputLabel for="venueName" value="Venue name: "/>
                            <p:inputText required="true" requiredMessage="Venue name is requied!"
                                         id="venueName" value="#{stakeholderPerformanceMB.venueName}"/>
                            <p:message for="venueName"/>

                            <h:outputLabel for="venueAddress" value= "Venue address: "/>
                            <p:inputTextarea required="true" requiredMessage="Address required!"
                                             id="venueAddress" value="#{stakeholderPerformanceMB.venueAddress}"/>
                            <p:message for="venueAddress"/>
                            
                             <h:outputText value="Upload Image: "/>
                             <h:form enctype="multipart/form-data" prependId="false">
                                <p:fileUpload fileUploadListener="#{photoManagedBean.handleEventPhotoUpload}" multiple="false" label="Browse" auto="true" allowTypes="*.jpg;*.png;*.gif;" description="Images" update="addVenue:pic" />
                            </h:form>
                             <br/>

                            <h:outputLabel for="pic" value="Preview Image: "/> 
                            <p:graphicImage id="pic" value="#{photoManagedBean.photoFilePath}" height="100"
                                            width="100"/>
                            <br/>
                            <h:outputLabel for="venueCapacity" value= "Venue Capacity Cap: "/>
                            <p:inputText required="true" requiredMessage="Capacity required"
                                         id="venueCapacity" value="#{stakeholderPerformanceMB.venueCapacity}">
                            </p:inputText>   
                            <p:message for="venueCapacity"/>

                            <h:outputLabel for="venueLatitude" value= "Venue Latitude: "/>
                            <p:inputText required="true" requiredMessage="Latitude required"
                                         id="venueLatitude" value="#{stakeholderPerformanceMB.venueLatitude}">

                            </p:inputText>
                            <p:message for="venueLatitude"/>

                            <h:outputLabel for="venueLongtitude" value= "Venue Longtitude: "/>
                            <p:inputText required="true" requiredMessage="Longtitude required"
                                         id="venueLongtitude" value="#{stakeholderPerformanceMB.venueLongtitude}">

                            </p:inputText>   
                            <p:message for="venueLongtitude"/> 

                            <h:outputLabel for="venueStatus" value= "Venue Status: "/>
                            <h:selectOneMenu id="venueStatus" style="width: 260px" value="#{stakeholderPerformanceMB.venueStatus}" requiredMessage="Status required!" required="true">
                                <f:selectItem itemLabel="Select One..." itemValue= ""/>
                                <f:selectItem itemLabel="Active" itemValue="Active"/>
                                <f:selectItem itemLabel="Inactive" itemValue="Inactive"/>
                            </h:selectOneMenu>
                            <p:message for="venueStatus"/> 
                        </h:panelGrid>
                        <br/>

                        <br/>
                        <h:commandButton id="submitNewVenue" value="Create Venue" onclick="if (!confirm('Are you sure you want to create new venue?')) return false"
                                         action="#{stakeholderPerformanceMB.createVenue(event)}" >
                             <f:setPropertyActionListener target="#{stakeholderPerformanceMB.venueLayout}" value="#{photoManagedBean.photoFilePath}" />
                         </h:commandButton>
                    </p:panel>
                </h:form>
                <br/>
                <br/>
            </p:layoutUnit>
        </p:layout>
    </h:body> 
</html>

